]> dgit.raspbian.org Git - ostree.git/commit
libarchive: Handle UTF-8 filenames without locale dependency
authorColin Walters <walters@verbum.org>
Thu, 8 Jan 2026 21:24:14 +0000 (16:24 -0500)
committerColin Walters <walters@verbum.org>
Wed, 21 Jan 2026 22:15:22 +0000 (17:15 -0500)
commit2fb111424ea36403db2ca8511f5adf145208474d
tree0219ddcb1aa184788addc98a4c94d15e3ea01757
parent911f9cd471f9d0f28160ba2a6a4394a70c466c42
libarchive: Handle UTF-8 filenames without locale dependency

When importing archives (including OCI container layers), libarchive
attempts to convert filenames from UTF-8 to the current locale charset.
In POSIX/C locale (which uses ASCII), this conversion fails for any
non-ASCII UTF-8 characters, returning ARCHIVE_WARN.

This is triggered by Python 3.14 which creates a "𝜋thon" symlink in
venvs, and affects bootc installations in environments where LANG is
not set (defaulting to POSIX locale).

Fix this by:

1. Using archive_entry_pathname_utf8() and archive_entry_symlink_utf8()
   which return UTF-8 directly without locale conversion

2. Falling back to the regular accessors with explicit UTF-8 validation
   when the _utf8 variants return NULL

3. Accepting ARCHIVE_WARN from archive_read_next_header() since we now
   validate UTF-8 ourselves rather than relying on libarchive charset
   conversion

This matches the behavior of GNU tar which treats filenames as opaque
bytes without charset conversion.

Closes: https://github.com/ostreedev/ostree/issues/3431
src/libostree/ostree-repo-libarchive.c
tests/test-libarchive.sh